<template>
	<view class="work-container">
		<view class="grid-body">
			<view class="bag">
				<view style="display: flex;flex-direction: column;padding: 17% 0 0 60rpx;">
					<text>{{ $t('login.username') }}</text>
					<text style="padding-bottom: 10rpx;">Hi,{{userName || '--'}}</text>
					<uni-dateformat :date="now" format="yyyy-MM-dd hh:mm:ss"></uni-dateformat>
				</view>
			</view>
			<uni-grid :column="4" :showBorder="false" style="position: absolute;top: 24%;">
				<uni-grid-item>
					<view class="grid-item-box" @click="gotoPage(0)">
						<view class="txt">
							<text class="tit">{{ $t('search:faceSearch') }}</text>
							<text class="text">{{ $t('search:imageSearchIdentity') }}</text>
						</view>
					</view>
				</uni-grid-item>
				<uni-grid-item>
					<view class="grid-item-box" @click="gotoPage(1)">
						<text class="tit">{{ $t('search:personSearch') }}</text>
						<text class="text">{{ $t('search:imageSearchTarget') }}</text>
					</view>
				</uni-grid-item>
				<uni-grid-item>
					<view class="grid-item-box" @click="gotoPage(2)">
						<text class="tit">{{ $t('search:vehicleSearch') }}</text>
						<text class="text">{{ $t('search:imageSearchTarget') }}</text>
					</view>
				</uni-grid-item>
			</uni-grid>
			<!-- <view style="position: absolute;left: 0;bottom: 0;display: flex;">
				<button @click="setLocale('zh-Hans')">中文</button>
				<button @click="setLocale('en')">English</button>
				<button @click="setLocale('ja')">日语</button>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {
		manageUser
	} from '@/api/mine.js'
	export default {
		data() {
			return {
				current: 0,
				swiperDotIndex: 0,
				data: [{
						image: '/static/images/banner/banner01.jpg'
					},
					{
						image: '/static/images/banner/banner02.jpg'
					},
					{
						image: '/static/images/banner/banner03.jpg'
					}
				],
				userName: '',
				now: Date.now()
			}
		},
		onShow() {
			this.manageDetail()
		},
		methods: {
			// setLocale(name) {
			// 	uni.setLocale(name)
			// 	this.$i18n.locale = name
			// },
			manageDetail() {
				manageUser({
					operatedUserId: localStorage.getItem("userId")
				}).then(res => {
					if (res.code === "00000000") {
						this.userName = res.data.datas[0]?.name
					}
				})
			},
			changeSwiper(e) {
				this.current = e.detail.current
			},
			gotoPage(e) {
				if (e == 0) {
					this.$tab.navigateTo('/pages/search/rljs/index')
				} else if (e == 1) {
					this.$tab.navigateTo('/pages/search/rtjs/index')
				} else if (e == 2) {
					this.$tab.navigateTo('/pages/search/cljs/index')
				}
			}
		}
	}
</script>

<style lang="scss">
	/* #ifndef APP-NVUE */
	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #fff;
		min-height: 100%;
		height: auto;
	}

	view {
		font-size: 14px;
		line-height: inherit;
	}

	/* #endif */

	.bag {
		background-image: url(../../static/images/bag01.png);
		background-size: 100% 100%;
		background-repeat: repeat;
		height: 500rpx;
		width: 100%;
		position: absolute;
		color: #fff;
	}

	.text {
		font-size: 12px;
		font-family: PingFang SC;
		font-weight: 400;
		color: #A5A5A5;

	}

	::v-deep.uni-grid-item__box {
		height: 100%;
		margin: 0 40rpx;
	}

	::v-deep .uni-grid {
		display: flex;
		flex-direction: column;
		justify-content: center;
		height: 100%;
	}

	::v-deep .uni-grid-item {
		width: 100% !important;
		height: 220rpx !important;
		margin: 20rpx 0;
	}

	.grid-item-box {
		display: flex;
		flex-direction: column;
		align-items: flex-end;
		justify-content: center;
		padding: 15px 35px;
		background-image: url(../../static/images/bag03.png);
		background-size: 100% 100%;
		height: 100%;
		background-repeat: repeat;
		box-shadow: 0px 4px 6px #A5A5A5;
	}

	.uni-grid-item:nth-child(2) .grid-item-box {
		background-image: url(../../static/images/bag02.png);
	}

	.uni-grid-item:nth-child(3) .grid-item-box {
		background-image: url(../../static/images/bag04.png);
	}

	.tit {
		font-size: 22px;
		font-family: PingFang SC;
		font-weight: 600;
		color: #000000;
		padding-bottom: 20rpx;
	}

	.txt {
		display: flex;
		flex-direction: column;
		align-items: center;
		// height: 70px;
		// line-height: 70px;
	}

	.uni-margin-wrap {
		width: 690rpx;
		width: 100%;
		;
	}

	.swiper {
		height: 300rpx;
	}

	.swiper-box {
		height: 150px;
	}

	.swiper-item {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		align-items: center;
		color: #fff;
		height: 300rpx;
		line-height: 300rpx;
	}

	@media screen and (min-width: 500px) {
		.uni-swiper-dot-box {
			width: 400px;
			/* #ifndef APP-NVUE */
			margin: 0 auto;
			/* #endif */
			margin-top: 8px;
		}

		.image {
			width: 100%;
		}
	}
</style>